<template>
  <div id="app">
    <el-menu router :default-active="$router.path" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <!--   战队总览   -->
      <el-menu-item index="/teamall">战队总览</el-menu-item>
      <!--   战队信息   -->
      <el-submenu index="team">
        <template slot="title">战队信息</template>
        <div v-for="(item,index) in teamname">
          <el-menu-item @click="reload()" :index="'/team/' + item" :key="index">战队{{ index }}</el-menu-item>
        </div>
      </el-submenu>
      <!--  对局记录详情  -->
      <el-submenu index="gamerecorddetail">
        <template slot="title">对局记录详情</template>
        <div v-for="(item,index) in gamerecordname">
          <el-menu-item @click="reload()" :index="'/gamerecorddetail/' + item.recordId" :key="index">
            对局记录{{ item.recordId }}
          </el-menu-item>
        </div>
      </el-submenu>
      <!--   粉丝团总览   -->
      <el-menu-item index="/fangroupall">粉丝团总览</el-menu-item>
      <!--  粉丝团详细  -->
      <el-submenu index="fangroup">
        <template slot="title">粉丝团详情</template>
        <div v-for="(item,index) in fangroup">
          <el-menu-item @click="reload()" :index="'/fangroup/' + item.groupId" :key="index">{{
              item.groupName
            }}
          </el-menu-item>
        </div>
      </el-submenu>
      <!--   个人信息   -->
      <el-menu-item index="/personalinformation">个人信息</el-menu-item>
    </el-menu>
    <div class="line"></div>
    <router-view/>
  </div>
</template>

<script>
import {request} from "./network/request";

export default {
  name: 'App',
  data() {
    return {
      activeIndex: '1',
      teamname: [],
      membername: [],
      gamerecordname: [],
      fangroup: []
    };
  },
  methods: {
    handleSelect() {

    },
    reload() {
      location.reload()
    }
  },
  created() {
    // team
    request({
      url: '/team/listId',
    }).then(res => {
      this.teamname = res.listId
    }).catch(err => {
      console.log(err)
    })
    // umember
    request({
      url: '/umember/listId',
    }).then(res => {
      this.membername = res.listId
    }).catch(err => {
      console.log(err)
    })
    // gamerecordname
    request({
      url: '/record/list',
    }).then(res => {
      this.gamerecordname = res.page.list
    }).catch(err => {
      console.log(err)
    })
    // fangroup
    request({
      url: '/fangroup/list',
    }).then(res => {
      this.fangroup = res.page.list
    }).catch(err => {
      console.log(err)
    })
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
}
</style>
